<?php
/**
 * 推荐分享
 *
 
 */
defined('InShopNC') or exit('Access Invalid!');

class recommendModel extends Model {
    public function __construct(){
        parent::__construct('recommend');
    }
    
    /**
     * 新增
     */
    public function saveRecommend($data){
        $param=array();
        if($data['member_id']!=null && !empty($data['member_id'])){
            $param['share_member_id']=$data['member_id'];
        }else{
            return false;
        } 
        $param['share_date']=TIMESTAMP;
        $param['share_used_register']=0;
        $result = $this->table('recommend')->insert($param);
        return $result;
    }
    
    /**
     * 更新
     */
    public function updateRegisterRecommend($share_id){
        $result = $this->table('recommend')->where(array('share_id'=>$share_id))->setInc('share_used_register',1);
        return $result;
    }
    /**
     * 获得单条信息
     */
    public function getOneRecommend($condition){
        $recommend_info = Model()->table('recommend')->where($condition)->find();
        return $recommend_info;
    }
    
    
}